package com.cathaypacific.facebook.login.utils

import android.content.pm.PackageManager
import android.content.Context
import android.content.pm.ApplicationInfo
import java.io.*


/**
 * Created by roy. on 4/3/2018.
 */
object MetaUtils {
    fun getMeta(context: Context, key: String): String? {
        var appInfo: ApplicationInfo? = context.packageManager.getApplicationInfo(context.packageName, PackageManager.GET_META_DATA);
        return appInfo?.metaData?.getString(key)

    }

    fun getStackTrace(t: Throwable): String {
        val sw = StringWriter()
        val pw = PrintWriter(sw)
        try {
            t.printStackTrace(pw)
            return sw.toString()
        } finally {
            pw.close()
        }
    }
}